//
//  XYJSCTableViewCell.m
//  徙游记-01
//
//  Created by hcios on 2017/7/14.
//  Copyright © 2017年 鹿林. All rights reserved.
//

#import "XYJSCTableViewCell.h"
#import "UIImageView+WebCache.h"

@interface XYJSCTableViewCell()

@property (weak, nonatomic) IBOutlet UIImageView *titleImageView;

@property (weak, nonatomic) IBOutlet UILabel *titleLab;

@property (weak, nonatomic) IBOutlet UILabel *contextLab;

@end

@implementation XYJSCTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    [self setupSubViews];
}


-(void)setupSubViews{
    [_titleLab setFont:[UIFont fontWithName:FONT_NAME_LTH size:16]];
    [_titleLab setTextColor:[UIColor blackColor]];
    
    [_contextLab setFont:[UIFont fontWithName:FONT_NAME_LTH size:13]];
    _contextLab.numberOfLines = 0;
    [_contextLab setTextColor:[UIColor blackColor]];
    
    self.imageView.layer.cornerRadius = 3;
    self.imageView.layer.masksToBounds = YES;
}


-(void)setModel:(XYJSCModel *)model{
    
    _titleLab.text = @"游记";
    _contextLab.text = model.sc_name;
    [self.titleImageView sd_setImageWithURL:[NSURL URLWithString:model.sc_front_cover_photo_url] placeholderImage:[UIImage imageNamed:@"zhanWeiTu"]];
}

-(void)setYJModel:(YJModel *)YJModel{
    
    _YJModel = YJModel;
    _titleLab.text = @"游记";
    _contextLab.text = YJModel.yj_name;
    [self.titleImageView sd_setImageWithURL:[NSURL URLWithString:YJModel.yj_front_cover_photo_url] placeholderImage:[UIImage imageNamed:@"zhanWeiTu"]];
}


+ (instancetype)cellModelWithTableViewCell:(UITableView *)tableView{
    
    NSString * cellID = @"XYJSCTableViewCell";
    
    XYJSCTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"XYJSCTableViewCell" owner:self options:nil] lastObject];
    } 
    cell.selectionStyle = UITableViewCellSelectionStyleDefault;
    cell.separatorInset = UIEdgeInsetsMake(0, 120, 0, 0);
    cell.layoutMargins = UIEdgeInsetsMake(0, 120, 0, 0);
    return cell;
}

@end
